package com.arrogames.blondbattle.input 
{
	import flash.events.Event;
	import org.as3commons.logging.api.getLogger;
	import org.as3commons.logging.api.ILogger;
	import org.gestouch.events.GestureEvent;
	import org.gestouch.gestures.SwipeGesture;
	import org.gestouch.gestures.SwipeGestureDirection;
	import starling.display.DisplayObject;
	/**
	 * ...
	 * @author Robin van den Bogaard
	 */
	public class TouchPoll {
		
		private static const logger:ILogger = getLogger(TouchPoll);
		private var _transformX:Number;
		
		public function TouchPoll(display:DisplayObject) {
			var swipeLeft:SwipeGesture = new SwipeGesture(display);
			swipeLeft.addEventListener(GestureEvent.GESTURE_RECOGNIZED, onSwipeGesture);
			swipeLeft.direction = SwipeGestureDirection.LEFT;
			
			var swipeRight:SwipeGesture = new SwipeGesture(display);
			swipeRight.addEventListener(GestureEvent.GESTURE_RECOGNIZED, onSwipeGesture);
			swipeRight.direction = SwipeGestureDirection.RIGHT;
			
			_transformX  = 0;
		}
		
		private function onSwipeGesture(e:Event):void {
			var swipe:SwipeGesture = e.target as SwipeGesture;
			transformX = swipe.offsetX;
		}
		
		public function get transformX():Number {
			var retVal:Number = _transformX;
			_transformX = 0;
			return retVal;
		}
		
		public function set transformX(value:Number):void {
			_transformX = value;
		}
	}

}